<template>
	<div>
		<div class="content1">
			<div class="zl_xd">
				好兄弟，帮帮忙，就差你了
			</div>
			<div class="gzjf">
				{{info.content}}
			</div>
			<div style="width: 100%;padding: 0 15px;color: white;">
				<router-link to="/zhuli">
					<div class="lan11">
						<input type="button" value="助力拼抢" class="yq" @click="enjoying"/>
					</div>
				</router-link>
			</div>
			<router-link to="/jifenshangcheng">
				<div class="lan_lan">
					<span>积分商城</span>
					<div class="clearfix"></div>
				</div>
			</router-link>
			<div class="clearfix"></div>
		</div>
		<div style="height: 8px;background:#F5F5F5;"></div>
		<div class="di">
			<ul class="pq">
				<li class="tu_1">
					<img :src=user.headimg >
				</li>
				<li>{{user.nickname}}的拼抢</li>
				<li class="pqz">{{person}}位好友已助力</li>
				<p class="clearfix"></p>
			</ul>
			<router-link :to="{path:'/jifenshangpingxiangqinger',query:{goods_id:order.goods_id}}">
				<div class="tu1">
					<div class="tupian1">
						<img :src=url+order.image >
					</div>
					<div class="wenzixin">
					  		<p style="font-size: 13px;color: #4a4a4a;line-height: 16px;">{{order.goods_name}}</p>
					  		<p style="font-size: 12px;color: #9b9b9b;line-height: 12px;margin-top: 5px;">{{order.attr_name}}</p>
					  		<p style="line-height: 13px;font-size: 14px;color: #ff2e22;margin-top: 9px;float: left;">¥{{order.price}}/次
					  		</p>
					  		<p class="j_sj">距结束 {{day}}天{{hours}}：{{minutes}}：{{miao}}</p>
				  		</div>
				  		<div class="clearfix"></div>
				</div>
			</router-link>
			<div style="width: 100%;border-top: 1px solid #EEEEEE;" @click="rule">
				<div class="ds">拼抢规则
					<p style="float: right;"><img src="static/arrow_right_gray.png"></p>
					<p class="clearfix"></p>
				</div>
			</div>
		</div>
		<div class="enen">
			嗯嗯，这就来啦
		</div>
		

		<div @click="disenjog1" v-show="enjoy1" style="width: 100%;height: 100%;background-color: rgba(0,0,0,0.5);position: absolute;top:0;left: 0;z-index: 1;">
			
		</div>
		<div v-show="enjoy1" style="z-index: 10; width: 250px;height: 240px;background: #FFFFFF;position: absolute;top:50%;left:50%;margin-left: -125px;margin-top: -120px;border-radius: 5px;">
			<div style="width:100%;height: 50px;background-color:#00C850;">
				<img src="static/guanzhu_title@3x.png" style="width: 100%;height: 100%;"/>
			</div>
			<div style="color: #333333;line-height: 15px;font-size: 15px;margin-top: 15px;text-align: center;">助力好友，请先关注公众号</div>
			<div style="color: #7F7F7F;line-height: 12px;font-size: 13px;margin-top: 8px;text-align: center;">长按下面指纹，识别二维码并关注</div>
			<div style="height: 110px;width: 220px;margin: 0 auto;background:#F5F5F5;margin-top: 12px;">
				<span style="display: block;height: 80px;width: 80px;float: left;margin: 10px;"><img src="static/code.png"></span>
				<span style="display: block;height: 90px;width: 90px;float: right;margin: 13px;"><img src="static/zhiwen.png"></span>
			</div>
		</div>


		<div @click="disenjog" v-show="enjoy" style="width: 100%;height: 100%;background-color: rgba(0,0,0,0.5);position: absolute;top:0;left: 0;z-index: 1;">
			<div v-show="off" style="color: #fff; line-height: 32px; text-align: center; position: absolute;top: 65%; left:calc(50% - 16px); height: 32px;width: 32px;border-radius: 50%;margin-top: 15px;"><img src="static/guanbi.png" style="display: block;width: 100%;"></div>
		</div>
		<div v-show="enjoy" style="z-index: 10; width: 250px;height: 160px;background: #FFFFFF;position: absolute;top:50%;left:50%;margin-left: -125px;margin-top: -80px;border-radius: 5px;">
			<div style="width:100%;height: 50px;background-color:#ffffff;padding: 17px 77px;border-bottom: 1px solid #EEEEEE;">
				<!--<img src="static/guanzhu_title@3x.png" style="width: 100%;height: 100%;"/>-->
				<span style="line-height: 16px;font-size: 16px;text-align: center;color: #333333;">如何参与拼抢</span>
			</div>
			<div style="width: 100%;margin-top: 20px;padding: 0 15px;">
				<div style="width: 1px; float: left; line-height: 17px;font-size: 13px;color: #7F7F7F;">·</div>
				<div style="margin-left: 8px; width: 210px; float: left; line-height: 17px;font-size: 13px;color: #7F7F7F;">{{rule1.content}}</div>
				<div class="clearfix"></div>
			</div>
			<!-- <div style="width: 100%;margin-top: 8px;padding: 0 15px;">
				<div style="width: 1px; float: left; line-height: 17px;font-size: 13px;color: #7F7F7F;">·</div>
				<div style="margin-left: 8px; width: 210px; float: left; line-height: 17px;font-size: 13px;color: #7F7F7F;">帮助者每帮朋友1元奖励10点积分</div>
			</div> -->
			
		</div>
		<loading :show="show2" :text="text1"></loading>
		<!-- <div v-show="isshow">暂无记录</div> -->
	</div>

</template>

<script>
	//import { Group, Cell } from 'vux'
	import { mapState, mapActions } from 'vuex'
	import axios from 'axios'
	export default {
		components: {
			//  Group,
			//  Cell,
			mapState,
		    mapActions
		},
		data() {
			return {
				enjoy:false,
				enjoy1:false,
				user:'',
				person:'',
				info:'',
				order:'',
				day:'',
				hours:'',
				minutes:'',
				miao:'',
				off:true,
				show2:false,
	  			text1:'loading...',
	  			isshow:false,
	  			rule1:'',
			}
		},
		methods: {
			enjoying(){
				this.enjoy = true;
			},
			disenjog(){
				this.enjoy = false;
				this.off = false;
			},
			disenjog1(){
				this.enjoy1 = false;
			},
			rule(){
				this.enjoy = true;
				this.off = true;
			},
			dateDif(begin,end){
			    var date = begin - end; 
			    var days    = date / 1000 / 60 / 60 / 24;
			    var daysRound   = Math.floor(days);
			    var hours    = date/ 1000 / 60 / 60 - (24 * daysRound);
			    var hoursRound   = Math.floor(hours);
			    var minutes   = date / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
			    var minutesRound  = Math.floor(minutes);
			    var seconds   = date/ 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
			    var secondsRound  = Math.floor(seconds);
			    var time = "倒计时"+(daysRound+"天"+hoursRound +"时"+minutesRound+"分"+secondsRound+"秒");
			    this.day = daysRound;
			    this.hours = hoursRound;
			    this.minutes = minutesRound;
			    this.miao = secondsRound;
			    setInterval(()=>{this.dajishi()},1000)
		    },
		    dajishi(){
		    	if(this.day == 0 && this.hours == 0 && this.minutes == 0 && this.miao == 0){
		    		this.day = 0;
		    		this.hours = 0;
		    		this.minutes = 0;
		    		this.miao = 0;
		    	}else{
			    	if(this.miao > 0){
			    		this.miao--;
			    	}else{
			    		this.miao = 59;
			    		if(this.minutes > 0){
			    			this.minutes--;
			    		}else{
			    			this.minutes = 59;
			    			if(this.hours > 0){
			    				this.hours--;
			    			}else{
			    				this.hours = 23;
			    				if(this.day >0){
			    					this.day--;
			    				}
			    			}
			    		}
			    		
			    	}
			    }
		    },
		},
		created(){
			// this.show2 = true;
			var order_id = this.$route.query.order_id;
			axios.post(this.url + '/Home/RobOrder/orderInvite',{openid:this.token,order_id:order_id}).then((res)=>{
				console.log(res);
				// if(res.data.order == null){
				// 	this.isshow = true;
				// }
				// this.show2 = false;
				this.user = res.data.nickname;
				this.person = res.data.ren;
				this.info = res.data.info;
				this.order = res.data.order;
				this.rule1 = res.data.rule;
				this.dateDif(res.data.order.start_time*1000,res.data.order.end_time*1000)
			})
		},
		computed:{
            ...mapState({
                token: state => state.Token.userToken()//获取用户Token
            })
        }
	}
</script>

<style scoped>
	body,html{margin: 0;
		background: #F5F5F5;
		padding: 0;
	}
	
	.content1 {
		width: 100%;
		border: 1px/*solid*/
		red;
		color: white;
		background: white;
		/*border: 1px solid red;*/
	}
.lan11{
	margin-top: 10px;
}	
	.zl_xd{
		padding: 15px 0;
		width: 100%;
		text-align: center;
		line-height: 20px;
		font-size: 16px;
		color: #333;
	}
	
	.gzjf {
		width: 100%;
		text-align: center;
		line-height: 17px;
		font-size: 13px;
		color: #7f7f7f;
		margin-top: 10px;
		padding: 0 15px;
	}


	
	.lan_lan {
		width: 100%;
		border: 1px /*solid*/ green;
		margin-bottom: 8px;
		color: #333333;
		padding: 0 15px;
		line-height: 13px;
		font-size: 13px;
		margin-top: 10px;
	}
	.lan_lan span{
		float: right;
		
	}
	.yq {
		margin: 0 auto;
		width: 100%;
		height: 44px;
		background-color: #00c850;
		color: #FFFFFF;
		line-height: 22px;
		border: 1px solid #00C850;
	}
	
	.lan2 {
		/*float: left;
		width: 100%;
		border: 1px solid green;
		line-height: 13px;
		font-size: 13px;
		color: #333;
		margin-left: 301px;
		margin-bottom: 20px;*/
	}
	
	.yq1 {
		padding: 0 20px;
		width: 100%;
		height: 44px;
		background-color: white;
		color: #00C850;
		line-height: 22px;
	}
	
	* {
		list-style: none;
		margin: 0;
		padding: 0;
	}
	
	.pq li {
		color: #333;
		float: left;
		line-height: 20px;
		font-size: 14px;
		margin-top: 10PX;
	}
	
	.pq .tu_1{
		height: 24px;
		width: 24px;
		border-radius: 50%;
		border: 1px/*solid*/
		black;
		margin: 0 3px;
		margin-top: 8PX;
	}
	.pq .tu_1 img{
		height: 24px;
		width: 24px;
	}
	.pq .pqz {
		float: right;
		color: #7f7f7f;
		line-height: 14px;
		font-size: 13px;
		margin-top: 13PX;
	}
	
	.wenzixin {
		margin-left: 5px;
		float: left;
		box-sizing: border-box;
		border: /*solid*/ yellow 1px;
		display: inline-block;
	}
	
	.di {
		margin-top: 50PX;
		box-sizing: border-box;
		border: /*solid*/
		1PX slateblue;
		margin-top: 10px;
		padding: 0 15px;
	}
	
	.hyzl {
		float: right;
		background: #9b9b9b;
		height: 12px;
		width: 12px;
		margin-top: 5px;
	}
	
	.ds {
		line-height:35px;
		font-size: 14px;
		color: #333;
		
	}
	
	.clearfix {
		float: none;
		clear: both;
	}
	
	.enen {
		width: 100%;
		font-size: 16px;
		color: #9b9b9b;
		text-align: center;
		padding-top: 30px;
		background: #F5F5F5;
		margin-top: 16px;
		display: table;
		background-color: #ffffff;
	}
	.tu1 {
		
		border-bottom: 1px solid red;
		border: 1px/*solid*/
		black;
		padding: 15px 0px;
	}
	
	.tupian1 {
		height: 60px;
		width: 60px;
		float: left;
	}
	.tupian1 img{
		height: 60px;
		width: 60px;
	}
.liangtian{
	float: right;
	line-height: 13px;
	font-size: 13px;
	color: #F8AF2C ;
	margin-top: -14px;
}	
.j_sj{
	
	line-height: 13px;
	font-size: 13px;
	color: #F8AF2C ;
	float: right;
	margin-top: 10px;
	margin-left:5px;
}
</style>